package com.ruoyi.quartz.task;

import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse;
import com.ruoyi.edu.domain.Activity;
import com.ruoyi.edu.service.IActivityService;
import com.ruoyi.framework.message.Producer;
import com.ruoyi.framework.web.domain.server.Sys;
import com.taobao.api.ApiException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("eduTask")
public class EduTask {

    @Autowired
    private IActivityService activityService;

    public void checkActivities() {
        StringBuilder sb = new StringBuilder("【通知】");
        for (Activity activity: activityService.selectIncompleteList()) {
            sb.append("社会活动记录'" + activity.getDetail() + "'未提供活动链接\n");
        }
//        sendDingTalkMsg(sb.toString());
        try {
            Producer.sendMessage(sb.toString());
        } catch (Exception e) {
            System.out.println("发送MQ消息异常");
        }
    }

}
